package obstaculos;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;


public class Esteira extends Obstaculo {

	public Esteira(int x, int y, BufferedImage img, BufferedImage imgA) {
		this.X = x;
		this.Y = y;
		XAtivacao = x;
		YInicial = y;
		this.sprite=img;
		this.spriteAtivacao = imgA;
		YAtivacao = 192;
		largura = 128;
		altura = 64;
		larguraAtivacao = 32;
		alturaAtivacao = 32;
	}

	@Override
	public void SimulaSe(long diftime) {
		// TODO Auto-generated method stub
		frametimer+=diftime;
		
		frame = (frametimer/animspeed)%3;
	}

	@Override
	public void DesenhaSe(Graphics2D dbg, int mapx, int mapy) {
		// TODO Auto-generated method stub
		if(ativado){
			dbg.drawImage(sprite, (int)X-mapx, (int)Y-mapy,(int)X+128-mapx, (int)Y+32-mapy, (frame*128)+128, anim*32, frame*128, anim*32+32, null);
			dbg.drawImage(spriteAtivacao, (int)XAtivacao-mapx, (int)YAtivacao-mapy,(int)XAtivacao+32-mapx, (int)YAtivacao+32-mapy, 32, 0,64, 32, null);
		}else{
			dbg.drawImage(sprite, (int)X-mapx, (int)Y-mapy,(int)X+128-mapx, (int)Y+32-mapy, 0, 0, 128, 32, null);
			dbg.drawImage(spriteAtivacao, (int)XAtivacao-mapx, (int)YAtivacao-mapy,(int)XAtivacao+32-mapx, (int)YAtivacao+32-mapy, 0, 0,32, 32, null);
		}
	}

}
